package com.iceframework.core.service;

import javax.annotation.Resource;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Service;

@Service("mQService")
public class MQService {
	
	@Resource
	private JmsTemplate jmsTemplate;
	
	public void sender(final String channel, final String data){
		jmsTemplate.send(channel, new MessageCreator() {
			@Override
			public Message createMessage(Session session) throws JMSException {
				return session.createTextMessage(data);
			}
		});
	}
	
}
